/***************************************************************************************************
  Copyright(C)   2011-9-13
  All rights reserved.
  File Name: examinitionthread.h

  Description:检测系统状态模块，主要是内存，硬盘，cpu使用率这３个

  ***************************************************************************************************/

#ifndef EXAMINITIONTHREAD_H
#define EXAMINITIONTHREAD_H

#include <QTimer>
#include <QDebug>
#include <QThread>
#include <QMetaType>

#include "log.h"
#include "systemexaminition.h"
#include "configclass.h"

#define CHANGEDEGREE 2


#define CHECKTIMES (1000 * 2)  //檢測系统時間，2秒檢測一次

class ExaminitionThread : public QThread
{
    Q_OBJECT
    LOG4QT_DECLARE_QCLASS_LOGGER

public:
    explicit ExaminitionThread(QObject *parent = 0);

    void close();

private:
    void run();
    void checkSysState();

private:
    SystemExaminition   m_systemExam;


    Configclass         m_configClass;
    SystemState         m_sysState;
    SystemState         m_testSysState;
    int                 m_changeCount;
    bool                 m_closeFlag;        //关闭此线程标志

    //cpu,硬盘,内存是否已经超过界限
    bool                m_cpuIsOverLim;
    bool                m_hardDiskIsOverLim;
    bool                m_memIsOverLim;


//    QTimer*             m_checkTimer;

signals:
    void systemState(const SystemState& cpuState);

public slots:
    void timeToCheckSys();
    void appCheckSysState();

};

#endif // EXAMINITIONTHREAD_H
